#ifndef USERAPI_H
#define USERAPI_H

#include <QObject>
#include <QMainWindow>
#include <QtNetwork>
#include <QDebug>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <Utils.h>
#include <config.h>
class UserApi : public QObject
{
    Q_OBJECT
public:
    explicit UserApi(QObject *parent = nullptr);
    QNetworkReply* login(QString username,QString pwd,QString code="",QString uuid = "");
    QNetworkReply* logout();
    //验证码信息
    QNetworkReply* captchaImage();
    //验证码图片
    QNetworkReply* codeImg(QString url);
    //个人信息
    QNetworkReply* getInfo();
    //个人信息
    QNetworkReply* profile();
    //根据id查用户
    QNetworkReply* getById(int id);
    //上传头像
    QNetworkReply* uploadAvatar(QString filePath);
    //更新个人信息
    QNetworkReply* updatePersonalInfo(User *user);
    //更新用户信息
    QNetworkReply* updateUser(User *user);
    //修改密码
    QNetworkReply* updatePwd(QString oldPwd,QString newPwd);
    //获取首页菜单
    QNetworkReply* getRouters();
    //添加用户
    QNetworkReply* addUser(User *user);
private:
    QString baseUrl ;
    QNetworkRequest request;
    QNetworkAccessManager *manager ;
signals:

};

#endif // USERAPI_H
